package it.espsoft.easysuperenalotto.logic;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Align;
import android.widget.ImageView;

public class TextIcon extends ImageView {
	private static final int CENTER_X = 18; 
	private static final int CENTER_y = 23;
	
	private String text;
	private int textColor;
	private Paint mTextPaint;
	
	public TextIcon(Context context) {
		super(context);
		this.text = "";
		this.setTextColor(Color.BLACK);
		initTextIcon();
	}

	@Override
	protected void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		
		mTextPaint.setColor(textColor);
        mTextPaint.setTextSize(14);
        mTextPaint.setAntiAlias(true);
        mTextPaint.setTextAlign(Align.CENTER);
        canvas.drawText(text, CENTER_X, CENTER_y, mTextPaint);
	}
	
	private final void initTextIcon() {
        mTextPaint = new Paint();
    }
	
	public String getText() {
		return text;
	}

	public void setText(String text) {
		this.text = text;
	}

	public void setTextColor(int textColor) {
		this.textColor = textColor;
	}

	public int getTextColor() {
		return textColor;
	}
}
